import type { UserInfo } from '@/api/type/interface';
import { defineStore } from 'pinia';

const publicBar = [
    {
        "pagePath": "/pages/home/index",
        "iconPath": "/static/image/home.png",
        "selectedIconPath": "/static/image/act-home.png",
        "text": "首页"
    },
    {
        "pagePath": "/pages/ydoc/index",
        "iconPath": "/static/image/doc.png",
        "selectedIconPath": "/static/image/act-doc.png",
        "text": "云文档"
    },
    {
        "pagePath": "/pages/mine/index",
        "iconPath": "/static/image/my.png",
        "selectedIconPath": "/static/image/act-myx.png",
        "text": "我的"
    }
]

const permissionBar = [
    {
        "pagePath": "/pages/home/index",
        "iconPath": "/static/image/home.png",
        "selectedIconPath": "/static/image/act-home.png",
        "text": "首页"
    },
    {
        "pagePath": "/pages/subAccount/index",
        "iconPath": "/static/image/sub.png",
        "selectedIconPath": "/static/image/act-sub.png",
        "text": "子账号"
    },
    {
        "pagePath": "/pages/ydoc/index",
        "iconPath": "/static/image/doc.png",
        "selectedIconPath": "/static/image/act-doc.png",
        "text": "云文档"
    },
    {
        "pagePath": "/pages/mine/index",
        "iconPath": "/static/image/my.png",
        "selectedIconPath": "/static/image/act-myx.png",
        "text": "我的"
    }
]

/**
 * 存入参数
 */
export const footerStore = defineStore('footer', {
    state: () => {  // 存放的就是模块的变量
        return {
            current: 0,
            tabBarList: <any>[]
        }
    },
    actions: {
        /** 获取他tabBar **/
        initTabBar(status) {
            this.tabBarList = status ? publicBar  : permissionBar
        },

        /** 设置当前curTab **/
        setCurrent(index: number) {
            this.current = index;
        }
    }
});
